import React, { useState, useEffect } from 'react';
import { connect } from 'dva';
import { IndexPageStyle, IndexPageContent } from './style.js';
import TopPage from '../components/topPageBack/index.jsx';
import LeftPage from '../components/leftPageBack/index.jsx';
import CenterPage from '../components/centerPageBack/index.jsx';
import RightPage from '../components/rightPageBack/index.jsx';
import { generateData } from '../components/meidi/utils.js';

const IndexPage = () => {
  const [data, setData] = useState(null);

  useEffect(() => {
    // 组件加载时初始化数据
    setData(generateData());
  }, []);


  if (!data) return <div>Loading...</div>;

  return (
    <IndexPageStyle>
      <TopPage />
      <IndexPageContent>
        {/* 左侧内容 */}
        <LeftPage />
        {/* 中间内容 */}
        <CenterPage className='center-page' />
        {/* 右侧内容 */}
        <RightPage />
      </IndexPageContent>
    </IndexPageStyle>
  );
};
export default connect()(IndexPage);